package com.zhieasy.service.impl;

import com.zhieasy.common.service.RedisService;
import com.zhieasy.domain.StudentVo;
import com.zhieasy.service.StudentListRedisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 风亦未止
 * @date 2021/11/26 18:00
 */
@Service
public class StudentListRedisServiceImpl implements StudentListRedisService {
    @Autowired
    private RedisService redisService;

    @Value("${redis.database}")
    private String REDIS_BASE;

    @Override
    public void set(List<StudentVo> studentVoList) {
        String key=REDIS_BASE+":"+"studentList";
        redisService.set(key,studentVoList);
    }

    @Override
    public List<StudentVo> get() {
        String key=REDIS_BASE+":"+"studentList";
        return (List<StudentVo>) redisService.get(key);
    }
}
